***Dependent Variables***
gen PoliceProt=Q62C_1
replace PoliceProt=. if Q62C_1==-1
label define PoliceProt 0 "Str. Disagree" 10 "Str. Agree", modify
label values PoliceProt PoliceProt

***Experimental Conditions***
gen CC_condn=Dov_Carey_condn
replace CC_condn=. if Dov_Carey_condn==-1
replace CC_condn=0 if Dov_Carey_condn==13
label define CC_condn 0 "Control", modify
label values CC_condn CC_condn

gen BlkProtester_condn=9
replace BlkProtester_condn=1 if CC_condn==1
replace BlkProtester_condn=1 if CC_condn==2
replace BlkProtester_condn=1 if CC_condn==3
replace BlkProtester_condn=1 if CC_condn==4
replace BlkProtester_condn=0 if CC_condn>=5
replace BlkProtester_condn=. if CC_condn==-1
label define BlkProtester_condn 0 "Otherwise" 1 "Black Protester", modify
label values BlkProtester_condn BlkProtester_condn

gen LatProtester_condn=9
replace LatProtester_condn=1 if CC_condn==5
replace LatProtester_condn=1 if CC_condn==6
replace LatProtester_condn=1 if CC_condn==7
replace LatProtester_condn=1 if CC_condn==8
replace LatProtester_condn=0 if CC_condn==1
replace LatProtester_condn=0 if CC_condn==2
replace LatProtester_condn=0 if CC_condn==3
replace LatProtester_condn=0 if CC_condn==4
replace LatProtester_condn=0 if CC_condn>=9
replace LatProtester_condn=. if CC_condn==-1
label define LatProtester_condn 0 "Otherwise" 1 "Latino Protester", modify
label values LatProtester_condn LatProtester_condn

gen WhtProtester_condn=9
replace WhtProtester_condn=1 if CC_condn==9
replace WhtProtester_condn=1 if CC_condn==10
replace WhtProtester_condn=1 if CC_condn==11
replace WhtProtester_condn=1 if CC_condn==12
replace WhtProtester_condn=0 if CC_condn==1
replace WhtProtester_condn=0 if CC_condn==2
replace WhtProtester_condn=0 if CC_condn==3
replace WhtProtester_condn=0 if CC_condn==4
replace WhtProtester_condn=0 if CC_condn==5
replace WhtProtester_condn=0 if CC_condn==6
replace WhtProtester_condn=0 if CC_condn==7
replace WhtProtester_condn=0 if CC_condn==8
replace WhtProtester_condn=0 if CC_condn==13
replace WhtProtester_condn=. if CC_condn==-1
label define WhttProtester_condn 0 "Otherwise" 1 "White Protester", modify
label values WhtProtester_condn WhttProtester_condn

gen RaceProt_condn=9
replace RaceProt_condn=0 if CC_condn==0
replace RaceProt_condn=1 if CC_condn==1
replace RaceProt_condn=1 if CC_condn==2
replace RaceProt_condn=1 if CC_condn==3
replace RaceProt_condn=1 if CC_condn==4
replace RaceProt_condn=2 if CC_condn==5
replace RaceProt_condn=2 if CC_condn==6
replace RaceProt_condn=2 if CC_condn==7
replace RaceProt_condn=2 if CC_condn==8
replace RaceProt_condn=3 if CC_condn==9
replace RaceProt_condn=3 if CC_condn==10
replace RaceProt_condn=3 if CC_condn==11
replace RaceProt_condn=3 if CC_condn==12
replace RaceProt_condn=. if CC_condn==-1
replace RaceProt_condn=. if RaceProt_condn==9
label define RaceProt_condn 0 "Control" 1 "Black Protester" 2 "Latino Protester" 3 "White Protester", modify
label values RaceProt_condn RaceProt_condn

gen Frame_condn=9
replace Frame_condn=0 if CC_condn==0
replace Frame_condn=1 if CC_condn==1
replace Frame_condn=1 if CC_condn==2
replace Frame_condn=1 if CC_condn==5
replace Frame_condn=1 if CC_condn==6
replace Frame_condn=1 if CC_condn==9
replace Frame_condn=1 if CC_condn==10
replace Frame_condn=2 if CC_condn==3
replace Frame_condn=2 if CC_condn==4
replace Frame_condn=2 if CC_condn==7
replace Frame_condn=2 if CC_condn==8
replace Frame_condn=2 if CC_condn==11
replace Frame_condn=2 if CC_condn==12
replace Frame_condn=. if Frame_condn==9
replace Frame_condn=. if CC_condn==-1
label define Frame_condn 1 "Social Order" 2 "Free Speech", modify
label values Frame_condn Frame_condn

gen LawandOrder_condn=9
replace LawandOrder_condn=0 if CC_condn==0
replace LawandOrder_condn=1 if CC_condn==1
replace LawandOrder_condn=1 if CC_condn==2
replace LawandOrder_condn=0 if CC_condn==3
replace LawandOrder_condn=0 if CC_condn==4
replace LawandOrder_condn=1 if CC_condn==5
replace LawandOrder_condn=1 if CC_condn==6
replace LawandOrder_condn=0 if CC_condn==7
replace LawandOrder_condn=0 if CC_condn==8
replace LawandOrder_condn=1 if CC_condn==9
replace LawandOrder_condn=1 if CC_condn==10
replace LawandOrder_condn=0 if CC_condn==11
replace LawandOrder_condn=0 if CC_condn==12
replace LawandOrder_condn=. if CC_condn==-1
replace LawandOrder_condn=. if LawandOrder_condn==9
label define LawandOrder_condn 0 "Control" 1 "Law and Order", modify
label values LawandOrder_condn LawandOrder_condn

gen FreeSpeech_condn=9
replace FreeSpeech_condn=0 if CC_condn==0
replace FreeSpeech_condn=0 if CC_condn==1
replace FreeSpeech_condn=0 if CC_condn==2
replace FreeSpeech_condn=1 if CC_condn==3
replace FreeSpeech_condn=1 if CC_condn==4
replace FreeSpeech_condn=0 if CC_condn==5
replace FreeSpeech_condn=0 if CC_condn==6
replace FreeSpeech_condn=1 if CC_condn==7
replace FreeSpeech_condn=1 if CC_condn==8
replace FreeSpeech_condn=0 if CC_condn==9
replace FreeSpeech_condn=0 if CC_condn==10
replace FreeSpeech_condn=1 if CC_condn==11
replace FreeSpeech_condn=1 if CC_condn==12
replace FreeSpeech_condn=. if CC_condn==-1
replace FreeSpeech_condn=. if FreeSpeech_condn==9
label define FreeSpeech_condn 0 "Control" 1 "Free Speech", modify
label values FreeSpeech_condn FreeSpeech_condn

gen Issue_condn=9
replace Issue_condn=0 if CC_condn==0
replace Issue_condn=1 if CC_condn==1
replace Issue_condn=1 if CC_condn==3
replace Issue_condn=1 if CC_condn==5
replace Issue_condn=1 if CC_condn==7
replace Issue_condn=1 if CC_condn==9
replace Issue_condn=1 if CC_condn==11
replace Issue_condn=2 if CC_condn==2
replace Issue_condn=2 if CC_condn==4
replace Issue_condn=2 if CC_condn==6
replace Issue_condn=2 if CC_condn==8
replace Issue_condn=2 if CC_condn==10
replace Issue_condn=2 if CC_condn==12
replace Issue_condn=. if Issue_condn==9
replace Issue_condn=. if CC_condn==-1
label define Issue_condn 0 "Control" 1 "Policing" 2 "Environment", modify
label values Issue_condn Issue_condn

***Measure of Race of Protester by Frame***
gen RaceProtByFrame=9
replace RaceProtByFrame=0 if Frame_condn==0
replace RaceProtByFrame=1 if RaceProt_condn==3 & Frame_condn==1
replace RaceProtByFrame=2 if RaceProt_condn==3 & Frame_condn==2
replace RaceProtByFrame=3 if RaceProt_condn==1 & Frame_condn==1
replace RaceProtByFrame=4 if RaceProt_condn==1 & Frame_condn==2
replace RaceProtByFrame=5 if RaceProt_condn==2 & Frame_condn==1
replace RaceProtByFrame=6 if RaceProt_condn==2 & Frame_condn==2
replace RaceProtByFrame=. if RaceProtByFrame==9
label define RaceProtByFrame 0 "Control" 1 "White LO" 2 "White PR" 3 "Black LO" 4 "Black PR" 5 "Latino LO" 6 "Latino PR", modify
label values RaceProtByFrame RaceProtByFrame

***recoding for raceeth (Race of Respondent)***
gen raceeth=RACEETH
replace raceeth=. if RACEETH==3
replace raceeth=. if RACEETH==5
replace raceeth=. if RACEETH==6
replace raceeth=3 if RACEETH==4
label define raceeth 1 "White" 2 "Black" 3 "Latino",modify
label values raceeth raceeth

***Sociodemographic Variables***
gen PID=QPID100
replace PID=2 if QPID100==6
replace PID=2 if QPID100==3
replace PID=3 if QPID100==2
replace PID=. if QPID100==-1
label define PID 1 "Republican" 2 "Independent" 3 "Democrat", modify
label values PID PID

***Main Effects (Media Frame)***
reg PoliceProt i.Frame_condn
margins, at (Frame_condn==(0 1 2))
marginsplot, xlab(-.25 " " 0 "Control" 1 "Social Order" 2 "Free Speech" 2.25 " ", notick)

***Interaction between Race of Protester and Frame***
reg PoliceProt i.RaceProtByFrame
margins, at (RaceProtByFrame==(0 1 2 3 4 5 6))
marginsplot, xlab(-.25 " " 0 "Control" 1 "White SO" 2 "White FS" 3 "Black SO" 4 "Black FS" 5 "Latino SO" 6 "Latino FS" 6.25 " ", notick)

***Interaction between Race of Protester and Race of Respondent***
reg PoliceProt i.raceeth i.RaceProt_condn raceeth##RaceProt_condn
margins RaceProt_condn, at (raceeth==(1 2 3))
***Search for mplotoffset under Stata search help. I downloaded Nick Winter's mplotoffset package from http://fmwww.bc.edu/RePEc/bocode/m***
mplotoffset, legend(rows(1))

***Interaction between Race of Protester and Party Affiliation***
reg PoliceProt i.PID i.RaceProt_condn PID##RaceProt_condn
margins RaceProt_condn, at (PID==(1 2 3))
mplotoffset

***Threeway interaction of experiment***
reg PoliceProt i.Issue_condn##i.RaceProtByFrame
margins Issue_condn, at (RaceProtByFrame==(0 1 2 3 4 5 6))
marginsplot, legend(rows(1))
